package me.zhengjie.server.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import me.zhengjie.dao.DispositionDao;
import me.zhengjie.mapper.DispositionMapper;
import me.zhengjie.server.DispositionService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class DispositionServiceImpl extends ServiceImpl<DispositionMapper, DispositionDao> implements DispositionService {

    @Resource
    private DispositionMapper dispositionMapper;


    @Override
    @Transactional(rollbackFor = Exception.class)
    public void updateStatusByLocal(String location, Integer status) {
        LambdaUpdateWrapper<DispositionDao> wrapper = new LambdaUpdateWrapper<>();
        wrapper.eq(DispositionDao::getLocation, location);
        wrapper.set(DispositionDao::getStatus, status);
        baseMapper.update(null, wrapper);
    }


}
